Report post

What are block comments used for?

Block comments are often used for formal documentation. Using comments to prevent execution of code is suitable for code testing. Adding // in front of a code line changes the code lines from an executable line to a comment. This example uses // to prevent execution of one of the code lines:

What is a single line comment in JavaScript?

JavaScript comments can also be used to prevent execution, when testing alternative code. Single line comments start with //. Any text between // and the end of the line will be ignored by JavaScript (will not be executed). This example uses a single-line comment before each code line:

Should EJS comments be inline comments?

This is more for documenting templates rather than commenting out blocks of code. Yes, if you require them to not be outputted then they must be js inline comments. The focus of EJS is making it easy to see what's going on, and that achieves that aim very effectively.

Does jQuery detect if a string contains a script block?

@MikeMoore - jQuery detects when the string passed to html () contains script blocks and if so, it doesn't use innerHTML. It will explicitly pluck out the script blocks and eval () them for you. See this thread for details. HTML comments in script blocks have not been necessary for many years.

Related articles

The World's Leading Crypto Trading Platform

Get my welcome gifts